﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using WindowsLive;
using SharingCenter.Web.Classes;

namespace SharingCenter.Web.delauth
{
    /// <summary>
    /// Summary description for $codebehindclassname$
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class LiveDelAuthHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            WindowsLiveLogin wll = new WindowsLiveLogin(true);
            WindowsLiveLogin.ConsentToken token = wll.ProcessConsent(context.Request.Form);
            HttpContext.Current.Session[WebConsts.SK_DELAUTH_TOKEN] = token;
            context.Response.Write("<script>this.close();</script>");
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
